<?php
namespace  app\admin\controller;

use app\admin\AdminCommon;
use think\Db;

class Collections extends AdminCommon
 {
   public  function  getindex()
   {
       $data=Db::table('tp_collections')->alias('tc')
           ->field('tc.id,tc.create_time,tu.user_name,tu.user_pic,tg.goods_name,tg.goods_pic')
           ->join('tp_user tu','tc.user_id=tu.id')
           ->join('tp_goods tg','tc.goods_id=tg.id')
           ->select();
       $i=0;
       foreach($data as $v)
       {
           $data[$i]['user_pic']='/uploads/user_pic/'.$v['user_pic'];
           $data[$i]['goods_pic']='/uploads/goods_pic/'.$v['goods_pic'];
           $data[$i]['create_time']=date('Y-m-d',$v['create_time']);
           $i++;
       }
       return $this->fetch('/collections/index',['data'=>$data,'b'=>1]);
   }
 }
?>